/**
 * @desc 数据源管理
 * @date 2023-09-11
 */
// 表头
const tableColumnData = [
  {
    label: '数据源编码',
    prop: 'sourceCode',
    tooltip: true,
    other: {
      color: '#409EFF'
    },
    align: "left"
  },
  {
    label: '数据源名称',
    prop: 'sourceName',
    tooltip: true,
  },
  {
    label: 'ip',
    prop: 'sourceIp',
    tooltip: true,
  },
  {
    label: '端口',
    prop: 'sourcePort',
    tooltip: true,
  },
  {
    label: '数据库名称',
    prop: 'dbName',
    tooltip: true,
  },
  {
    label: '数据源类型',
    prop: 'sourceType',
    tooltip: true,
  },
  {
    label: '登录名',
    prop: 'loginName',
    tooltip: true,
  },
  {
    label: '密码',
    prop: 'password',
    tooltip: true,
  },
  {
    label: '服务名称',
    prop: 'serviceName',
    tooltip: true,
  },
  {
    label: '使用状态',
    prop: 'useState',
    tooltip: true,
  },
]

// 基本信息内容
const formRow = [
  {
    elCol: [{
      label: '数据源编码',
      prop: 'sourceCode',
      tag: 'elInput',
      span: 24,
      disabled: false,
    }]
  },
  {
    elCol: [{
      label: '数据源名称',
      prop: 'sourceName',
      tag: 'elInput',
      span: 24,
      disabled: false,
    }]
  },
  {
    elCol: [{
      label: 'ip',
      prop: 'sourceIp',
      tag: 'elInput',
    }, {
      label: '端口',
      prop: 'sourcePort',
      tag: 'elInput',
    }]
  },
  {
    elCol: [{
      label: '数据库名称',
      prop: 'dbName',
      tag: 'elInput',
    }, {
      label: '数据源类型',
      prop: 'sourceType',
      tag: 'elSelect',
      options: [
        {
          value: "1",
          label: "oracle"
        },
        {
          value: "2",
          label: "sqlsever"
        },
        {
          value: "3",
          label: "mysql"
        },
      ],
    }]
  },
  {
    elCol: [{
      label: '登录名',
      prop: 'loginName',
      tag: 'elInput',
    }, {
      label: '密码',
      prop: 'password',
      tag: 'elInput',
    }]
  },
  {
    elCol: [{
      label: '服务名称',
      prop: 'serviceName',
      tag: 'elInput',
      show:false
    }, {
      label: '使用状态',
      prop: 'useState',
      tag: 'elRadio',
      options: [{
        label: '启用',
        value: 1
      }, {
        label: '锁定',
        value: 0
      }
      ]
    },]
  },
]

const basicsRules = {
  sourceCode: [{
    required: true,
    message: '请输入数据源编码',
    trigger: 'blur'
  }],
  sourceName: [{
    required: true,
    message: '请输入数据源名称',
    trigger: 'blur'
  }],
  sourceIp: [{
    required: true,
    message: '请输入ip',
    trigger: 'blur'
  }],
  sourcePort: [{
    required: true,
    message: '请输入端口',
    trigger: 'blur'
  }],
  dbName: [{
    required: true,
    message: '请输入数据库名称',
    trigger: 'blur'
  }],
  sourceType: [{
    required: true,
    message: '请选择数据源类型',
    trigger: 'blur'
  }],
  loginName: [{
    required: true,
    message: '请输入登录名',
    trigger: 'blur'
  }],
  password: [{
    required: true,
    message: '请输入密码',
    trigger: 'blur'
  }],
  serviceName: [{
    required: true,
    message: '请输入服务名称',
    trigger: 'blur'
  }],
  useState: [{
    required: true,
    message: '请选择使用状态',
    trigger: 'blur'
  }],
}

// 查看
const formRowShow = [
  {
    elCol: [{
      label: '数据源编码',
      prop: 'sourceCode',
      tag: 'elInput',
      span: 24,
      disabled: true,
    }]
  },
  {
    elCol: [{
      label: '数据源名称',
      prop: 'sourceName',
      tag: 'elInput',
      span: 24,
      disabled: true,
    }]
  },
  {
    elCol: [{
      label: 'ip',
      prop: 'sourceIp',
      tag: 'elInput',
      disabled: true,
    }, {
      label: '端口',
      prop: 'sourcePort',
      tag: 'elInput',
      disabled: true,
    }]
  },
  {
    elCol: [{
      label: '数据库名称',
      prop: 'dbName',
      tag: 'elInput',
      disabled: true,
    }, {
      label: '数据源类型',
      prop: 'sourceType',
      tag: 'elSelect',
      disabled: true,
      options: [
        {
          value: "1",
          label: "oracle"
        },
        {
          value: "2",
          label: "sqlsever"
        },
        {
          value: "3",
          label: "mysql"
        },
      ],
    }]
  },
  {
    elCol: [{
      label: '登录名',
      prop: 'loginName',
      tag: 'elInput',
      disabled: true,
    }, {
      label: '密码',
      prop: 'password',
      tag: 'elInput',
      disabled: true,
    }]
  },
  {
    elCol: [{
      label: '服务名称',
      prop: 'serviceName',
      tag: 'elInput',
      disabled: true,
    }, {
      label: '使用状态',
      prop: 'useState',
      tag: 'elRadio',
      disabled: true,
      options: [{
        label: '启用',
        value: 1
      }, {
        label: '锁定',
        value: 0
      }
      ]
    },]
  },
]

export default {
  tableColumnData,
  formRow,
  basicsRules,
  formRowShow,
}